﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace atmsystem_ss
{
    public partial class frmCustomer_Account : Form
    {

        private SqlConnection con = new SqlConnection();
        private DataTable dtAccount = new DataTable("tblAccount");
        private DataTable dtCustomer = new DataTable("tblCustomer");
        private SqlDataAdapter da = new SqlDataAdapter();
        public string strID_Account_FCA { set; get; }

        private void connect()
        {
            string cn = "Server=.\\SQLEXPRESS;Database=atmsystemsangson;User Id=sa;Password=123456";
            try
            {
                con = new SqlConnection(cn);
                con.Open();//mo ket noi

            }
            catch (Exception ex)
            {
                MessageBox.Show("Khong ket noi duoc co so du lieu", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void disconnect()
        {
            con.Close();//dong ket noi
            con.Dispose();//giai phong tai nguyen
            con = null;//huy doi tuong

        }
        public frmCustomer_Account()
        {
            InitializeComponent();
        }
        //private void hienthiFull_Name()
        //{
          //  dtCustomer.Clear();
           // SqlCommand command = new SqlCommand();
           // command.Connection = con;
            //command.CommandType = CommandType.Text;
           // command.CommandText = @"select distinct fldFull_Name from tblCustomer join tblAccount on tblCustomer.fldID_Customer = tblAccount.fldID_Customer where fldID_Account LIKE '%'+@fldID_Account+'%' ";
            //command.Parameters.Add("@fldID_Account", SqlDbType.VarChar, 50).Value = strID_Account_FCA.ToString();
           // da.SelectCommand = command;
            //da.Fill(dtCustomer);
            //label1.DataBindings.Add("Text", dtCustomer, "fldFull_Name", true);
        //}
        private void frmCustomer_Account_Load(object sender, EventArgs e)
        {
            
            connect();
            //hienthiFull_Name();
        }

        private void btnRuttien_Click(object sender, EventArgs e)
        {
            frmWithdraw _frmWithdraw = new frmWithdraw();
            _frmWithdraw.strID_Account = strID_Account_FCA;
            _frmWithdraw.Show();
            Hide();
        }
    }
}
